


class Animal:
    name = 'animal'

    def shout(self):
        print('animal shout')

        animal = Animal()
        print(animal.name)
        animal.shout()

        class Dog:
            name = 'dog'

            def eat(self):
                self.age = 10
                print('dog eat')

        dog1 = Dog()
        print(dog1.name)
        print((Dog.name))

        dog1.name = 'dog001'
        print(dog1.name)
        print(Dog.name)

        Dog.name = 'dog000'
        print(dog1.name)
        print(Dog.name)
        print('-----------')
        dog2 = Dog()
        print(dog2.name)
        # 只有类能更改属性
        print(dog2.age)
